package gagnatech.controller;

import gagnatech.entity.Media;
import gagnatech.entity.User;
import gagnatech.service.ServiceUser;
import java.util.Vector;

public class ControlerUser {

	
	private ServiceUser serviceUser;
	private String login;
	private String mdp;
	private User user;
	
	private Vector<Media> listMedia;

	public ControlerUser() {

		serviceUser = new ServiceUser();

		listMedia = new Vector<Media>();

		login = "";
		mdp = "";
		user = null;
	}

	public String connect() {
		
		try {
			user = serviceUser.getManagerUser().connect(login, mdp);
			System.out.println("1 ************************");
			return "list";	
		} catch (Exception e) {
			System.out.println("2 ************************");
			return null;
		}
		
	}

	public boolean addUser(User user) {
		return serviceUser.getManagerUser().addUser(user);
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getMdp() {
		return mdp;
	}

	public void setMdp(String mdp) {
		this.mdp = mdp;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Vector<Media> getListMedia() {
		//serviceUser.get
		return listMedia;
	}

	public void setListMedia(Vector<Media> listMedia) {
		this.listMedia = listMedia;
	}
	
	
}
